package cn.com.cetccst.datacenter.policy.entity;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.PrimaryKey;

import java.util.Objects;

@Entity(tableName = RestrictionStatusEntity.TABLE_NAME)
public class RestrictionStatusEntity {
    public static final String TABLE_NAME = "restriction_status_entity";

    @PrimaryKey()
    @NonNull
    @ColumnInfo(name = "name")
    private String name;

    //0：禁用，1：启用
    @ColumnInfo(name = "expected", defaultValue = "0")
    private int expected;
    @ColumnInfo(name = "actual", defaultValue = "0")
    private int actual;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getExpected() {
        return expected;
    }

    public void setExpected(int expected) {
        this.expected = expected;
    }

    public int getActual() {
        return actual;
    }

    public void setActual(int actual) {
        this.actual = actual;
    }

    @Override
    public boolean equals(@Nullable Object obj) {
        if(obj instanceof RestrictionStatusEntity entity) {
            return Objects.equals(name, entity.name) &&
                    expected == entity.getExpected() &&
                    actual == entity.getActual();
        }
        return false;
    }
}
